fix: Resolve Firebase Not Initializing in Production - Issue #284#287
Open
NithinRegidi wants to merge 3 commits intoeccentriccoder01:mainfrom
Open
fix: Resolve Firebase Not Initializing in Production - Issue #284#287NithinRegidi wants to merge 3 commits intoeccentriccoder01:mainfrom
NithinRegidi wants to merge 3 commits intoeccentriccoder01:mainfrom
Conversation
|
@NithinRegidi is attempting to deploy a commit to the eccentriccoder01's projects Team on Vercel. A member of the Team first needs to authorize it. |
Thanks for creating a PR for your Issue!
|
Author
|
@eccentriccoder01 Please review this PR Once. |
|
Deployment failed with the following error: Learn More: https://vercel.link/mix-routing-props |
Owner
@NithinRegidi Kindly look into the vercel-specific preview-deployment route error and fix 'em... Routes and Redirects cannot be used together... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Firebase was failing to initialize in production because the application was using hardcoded API keys and
import.meta.env(which doesn't work in browser environments). This caused authentication and database features to break on pages like profile, proposals, and create-proposal.What changes are included in this PR?
/api/configendpoint inserver.jsto serve Firebase configuration from environment variablesscripts/env.jsto load Firebase config from the server API before Firebase initializationscripts/firebase-config.jsto usewindow.firebaseConfiginstead ofimport.meta.envenv.jsincludes to all Firebase-dependent HTML files (profile.html, proposals.html, forgot-password.html, login.html, register.html, create-proposal.html)server.jsto allow Firebase source map requests.env.examplewith architecture explanation and setup instructionsenv.jsfrom.gitignoreto track the new fileAre these changes tested?
Yes, changes were tested locally:
/api/configendpoint returns complete Firebase configurationAre there any user-facing changes?
No breaking changes. Users will now have working Firebase authentication and database features on all pages that previously failed. The changes are internal and improve reliability without affecting the UI or user experience.
Removed Hardcoded API Keys from the project codebase, because it is open to everyone to make use of it.
Clean console errors by fixing Firebase initialization and CSP violations